/**
 * @file MainGuiQml.h
 * @author rui.liang (rui.liang@ruhnix.com)
 * @brief 
 * @version 1.0
 * @date 2025-10-18
 * 
 * @copyright Copyright (c) 2025
 * 
 */

#ifndef DEVKITS_GUI_QML_H
#define DEVKITS_GUI_QML_H

#include <QApplication>

#include "QmlGuiGlobal.h"

class Backend;
class QQmlApplicationEngine;

class GUIQML_EXPORT MainGuiQml {
  public:
    using Ptr = std::shared_ptr<MainGuiQml>;
    static Ptr create();

    /**
     * Start application
     * @param app
     * @return
     */
    int exec(QApplication &app);

    MainGuiQml() = delete;

  private:
    explicit MainGuiQml(QQmlApplicationEngine *engine, Backend *backend);

    QQmlApplicationEngine *m_engine = nullptr;
    Backend *m_backend = nullptr;
};

#endif // DEVKITS_GUI_QML_H
